/*
Smallest multiple
Problem 5

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
*/

var linq = require('linq');
var start = new Date().getTime();

var p = -1;

var findNumber = function () {

    var number = -1;

    for (var number = 1; number < 999999999; number++) {
        var remainder = 0;

        for (var divider = 20; divider >= 10; divider--) {
            remainder = number % divider;
            
            if(remainder != 0)
                break;
        }

        if (remainder == 0)
            break;
    }

    return number;
};

p = findNumber();

var end = new Date().getTime();
var time = end - start;

console.log("Number: ", p);
console.log("Time: ", time);

require('readline')
    .createInterface(process.stdin, process.stdout)
    .question("Press [Enter] to exit...", function(){
        process.exit();
});